import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetCheckCalculationFormula_ {
  /**
   * @description combination
   */
  combination: string;
}
export interface GetHintMetrics_ {
  /**
   * @description 在取数任务中已经选择使用的维度id列表
   */
  chosenDimensionIds?: number[];
  /**
   * @description 在取数任务中已经选择使用的指标id列表
   */
  chosenMetricsIds?: number[];
  /**
   * @description 指标是否限定于用户的收藏
   */
  isMetricsFavorite?: boolean;
  /**
   * @description 在取数任务中指定的指标模糊搜索内容
   */
  metricsContent?: string;
}
export interface GetHintMetricsDimension_ {
  /**
   * @description 在取数任务中已经选择使用的维度id列表
   */
  chosenDimensionIds?: number[];
  /**
   * @description 在取数任务中已经选择使用的指标id列表
   */
  chosenMetricsIds?: number[];
  /**
   * @description 在取数任务中指定的维度模糊搜索内容
   */
  dimensionContent?: string;
  /**
   * @description 指标是否限定于用户的收藏
   */
  isMetricsFavorite?: boolean;
  /**
   * @description 在取数任务中指定的指标模糊搜索内容
   */
  metricsContent?: string;
}
export interface GetHisLog_ {
  /**
   * @description taskHisId
   * @format int32
   */
  taskHisId: number;
}
export interface GetHisStatus_ {
  /**
   * @description taskHisId
   * @format int32
   */
  taskHisId?: number;
}
export interface GetTaskDetailById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetTaskHisDataDownload_ {
  /**
   * @description hisIds
   */
  hisIds: number[];
}

export class TaskManagerV1 {
  /**
   * 校验组合逻辑是否合法
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/check-calculation-formula
   * @secure
   */
  getCheckCalculationFormula = (
    query: { combination: string } | GetCheckCalculationFormula_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/check-calculation-formula`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 删除任务
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/del-task
   * @secure
   */
  postDelTask = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/del-task`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 删除历史数据
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/del-task-his
   * @secure
   */
  postDelTaskHis = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/del-task-his`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 手动执行
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/exec-task
   * @secure
   */
  postExecTask = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/exec-task`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 手动执行历史
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/exec-task-his
   * @secure
   */
  postExecTaskHis = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/exec-task-his`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 维度下拉框获取数据
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/getDimensionEnum
   * @secure
   */
  postGetDimensionEnum = (getDimensionInfoDTO: defs.GetDimensionInfoDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListMapStringString>({
      url: `/task-manager-v1/getDimensionEnum`,
      method: "POST",
      data: getDimensionInfoDTO,
      ...params,
    });

  /**
   * 取数任务时模糊搜索指标以添加组合
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/hint-metrics
   * @secure
   */
  getHintMetrics = (
    query:
      | {
          chosenDimensionIds?: number[];
          chosenMetricsIds?: number[];
          isMetricsFavorite?: boolean;
          metricsContent?: string;
        }
      | GetHintMetrics_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListGetNumMetricsVO>({
      url: `/task-manager-v1/hint-metrics`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 取数任务时模糊搜索指标和维度
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/hint-metrics-dimension
   * @secure
   */
  getHintMetricsDimension = (
    query:
      | {
          chosenDimensionIds?: number[];
          chosenMetricsIds?: number[];
          dimensionContent?: string;
          isMetricsFavorite?: boolean;
          metricsContent?: string;
        }
      | GetHintMetricsDimension_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityGetNumMetricsAndDimensionVO>({
      url: `/task-manager-v1/hint-metrics-dimension`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 日志记录
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/his-log
   * @secure
   */
  getHisLog = (query: { taskHisId: number } | GetHisLog_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/his-log`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 查询历史状态
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/his-status
   * @secure
   */
  getHisStatus = (query: { taskHisId?: number } | GetHisStatus_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/his-status`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 历史数据列表
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/list-data
   * @secure
   */
  postListData = (taskDataDTO: defs.TaskDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/list-data`,
      method: "POST",
      data: taskDataDTO,
      ...params,
    });

  /**
   * 预览数据
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/preview-data
   * @secure
   */
  postPreviewData = (getNumTaskConfig: defs.GetNumTaskConfig, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/preview-data`,
      method: "POST",
      data: getNumTaskConfig,
      ...params,
    });

  /**
   * 保存任务
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/save-task
   * @secure
   */
  postSaveTask = (getNumTask: defs.GetNumTaskDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/save-task`,
      method: "POST",
      data: getNumTask,
      ...params,
    });

  /**
   * 取数任务详情
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/task-detail/{id}
   * @secure
   */
  getTaskDetailById = ({ id }: { id: number } | GetTaskDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityGetNumTaskVO>({
      url: `/task-manager-v1/task-detail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 任务历史
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/task-his
   * @secure
   */
  postTaskHis = (taskHisSearchDTO: defs.TaskHisSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/task-his`,
      method: "POST",
      data: taskHisSearchDTO,
      ...params,
    });

  /**
   * 取数任务历史数据下载
   *
   * @tags 任务管理v1
   * @request GET: /task-manager-v1/task-his/data/download
   * @secure
   */
  getTaskHisDataDownload = (query: { hisIds: number[] } | GetTaskHisDataDownload_, params: AxiosRequestConfig = {}) =>
    http.request<void>({
      url: `/task-manager-v1/task-his/data/download`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 任务列表
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/task-list
   * @secure
   */
  postTaskList = (taskSearchDTO: defs.TaskSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/task-list`,
      method: "POST",
      data: taskSearchDTO,
      ...params,
    });

  /**
   * 修改任务
   *
   * @tags 任务管理v1
   * @request POST: /task-manager-v1/update-task
   * @secure
   */
  postUpdateTask = (getNumTask: defs.GetNumTaskDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-v1/update-task`,
      method: "POST",
      data: getNumTask,
      ...params,
    });
}

export default new TaskManagerV1();
